group { name: "elm/multibuttonentry/base/default";
   data.item: "horizontal_pad" 0;
   data.item: "vertical_pad" 0;
   data.item: "closed_height" 0;
   parts {
      part { name: "bg"; type: RECT;
         description { state: "default" 0.0;
            color: 0 0 0 0; // no cc
         }
      }
      part { name: "elm.swallow.background"; type: SWALLOW;
         scale: 1;
         description { state: "default" 0.0;
            rel.to: "bg";
         }
      }
      /* this widget was released with non-namespaced parts in legacy api */
      alias: "box.swallow" "elm.swallow.box";
      part { name: "elm.swallow.box"; type: SWALLOW;
         description { state: "default" 0.0;
            rel.to: "bg";
         }
      }
   }
}

group { name: "elm/multibuttonentry/label/default";
   parts {
      part { name: "elm.text"; type: TEXT; mouse_events: 0;
         scale: 1;
         description { state: "default" 0.0;
            color_class: "/fg/normal/multibuttonentry/text";
            text { font: FNBD; size: 10;
               min: 1 1;
               ellipsis: -1;
               align: 0.5 0.5;
               text_class: "multibuttonentry_label";
            }
            rel1.offset: 4 4;
            rel2.offset: -5 -5;
            offscale;
         }
      }
   }
}

group { name: "elm/multibuttonentry/guidetext/default";
   parts {
      part { name: "elm.text"; type: TEXT;
         scale: 1;
         description { state: "default" 0.0;
            rel1.offset: 4 4;
            rel2.offset: -5 -5;
            color_class: "/fg/normal/multibuttonentry/text/guide";
            text { font: FNBD; size: 10;
               min: 0 1;
               align: 0.0 0.5;
            }
            offscale;
         }
      }
   }
}

group { name: "elm/multibuttonentry/btn/default";
   styles {
      style { name: "multibuttonentry_textblock_style";
         base: "font="FN" align=0.5 font_size=10 color=#fff text_class=multibuttonentry_item ellipsis=1.0"; // no cc for color
         tag: "br" "\n";
         tag: "ps" "ps";
         tag: "hilight" "+ font="FNBD;
         tag: "b" "+ font="FNBD;
         tag: "tab" "\t";
      }
   }

   script {
      public disabled = 0;
   }

   parts {
      part { name: "base"; type: RECT;
         scale: 1;
         description { state: "default" 0.0;
            color_class: "/bg/normal/multibuttonentry/button";
            rel1.offset: 2 2;
            rel2.offset: -3 -3;
            offscale;
         }
         description { state: "pressed" 0.0;
            inherit: "default" 0.0;
            color_class: "/bg/pressed/multibuttonentry/button";
         }
      }
      part { name: "glow"; type: RECT; mouse_events: 0;
         description { state: "default" 0.0;
            rel.to: "base";
            rel1.offset: 0 -1;
            rel1.relative: 0.0 1.0;
            align: 0.5 1.0;
            color_class: "/bg/selected/multibuttonentry/button/bar";
            visible: 0;
         }
         description { state: "focused" 0.0;
            inherit: "default" 0.0;
            min: 0 5;
            visible: 1;
         }
         description { state: "unfocused" 0.0;
            inherit: "default" 0.0;
         }
      }
      part { name: "close"; mouse_events: 0;
         scale;
         description { state: "default" 0.0;
            image.normal: "i-close";
            rel.to: "del";
            min: 15 15;
            max: 15 15;
            fixed: 1 1;
            color_class: "/fg/normal/multibuttonentry/button/delete";
         }
         description { state: "clicked" 0.0;
            inherit: "default" 0.0;
            color_class: "/fg/pressed/multibuttonentry/button/delete";
         }
      }
      part { name: "del"; type: RECT;
         scale: 1;
         description { state: "default" 0.0;
            fixed: 1 0;
            min: 15 15;
            align: 1.0 0.5;
            rel.to: "base";
            rel1.relative: 1.0 0.0;
            rel1.offset: -5 4;
            rel2.offset: -5 -5;
            color: 0 0 0 0; // no cc
            offscale;
         }
      }
      part { name: "elm.btn.text"; type: TEXTBLOCK; mouse_events: 0;
         scale: 1;
         description { state: "default" 0.0;
            rel1.offset: 4 4;
            rel2.offset: -5 -5;
            rel1.to: "base";
            rel2.to_x: "del";
            rel2.to_y: "base";
            rel2.relative: 0.0 1.0;
            text { style: "multibuttonentry_textblock_style";
               min: 1 1;
               ellipsis: -1;
               text_class: "multibuttonentry_item_text";
            }
            visible: 0;
            offscale;
         }
      }
      part { name: "text"; type: TEXTBLOCK; mouse_events: 0;
         scale: 1;
         description { state: "default" 0.0;
            rel.to: "elm.btn.text";
            align: 0.0 0.5;
            text { style: "multibuttonentry_textblock_style";
               text_source: "elm.btn.text";
               min: 0 1;
               align: 0.0 0.5;
               text_class: "multibuttonentry_item_text";
            }
            color_class: "/fg/normal/multibuttonentry/text/button";
         }
         description { state: "pressed" 0.0;
            inherit: "default";
            color_class: "/fg/pressed/multibuttonentry/text/button";
         }
         description { state: "disabled" 0.0;
            inherit: "default";
            color_class: "/fg/disabled/multibuttonentry/text/button";
         }
      }
   }
   programs {
      program { signal: "mouse,clicked,1"; source: "base";
         script {
            if (get_int(disabled) == 0) {
               emit("clicked", "");
            }
         }
      }
      program { signal: "elm,state,default"; source: "elm";
         action: STATE_SET "default" 0.0;
         transition: SINUSOIDAL 0.2;
         target: "glow";
      }
      program { signal: "elm,state,focused"; source: "elm";
         action: STATE_SET "focused" 0.0;
         transition: SINUSOIDAL 0.2;
         target: "glow";
      }
      program { signal: "elm,state,enabled"; source: "elm";
         script {
            set_state(PART:"text", "default", 0.0);
            set_int(disabled , 0);
         }
      }
      program { signal: "elm,state,disabled"; source: "elm";
         script {
            new st[31];
            new Float: vl;
            get_state(PART:"glow", st, 30, vl);
            if (!strcmp(st, "focused"))
              set_state(PART:"glow", "default", 0.0);
            set_state(PART:"text", "disabled", 0.0);
            set_int(disabled , 1);
         }
      }
      program { signal: "elm,state,unfocused"; source: "elm";
         action: STATE_SET "unfocused" 0.0;
         target: "glow";
      }
      program { signal: "mouse,down,1"; source: "base";
         script {
            if (get_int(disabled) == 0) {
               set_state(PART:"base", "pressed", 0.0);
               set_state(PART:"text", "pressed", 0.0);
            }
         }
      }
      program { signal: "mouse,up,1"; source: "base";
         script {
            if (get_int(disabled) == 0) {
               set_state(PART:"base", "default", 0.0);
               set_state(PART:"text", "default", 0.0);
            }
         }
      }
      program { signal: "mouse,clicked,1"; source: "del";
         action: SIGNAL_EMIT "elm,deleted" "elm";
      }
      program { signal: "mouse,down,1"; source: "del";
         action: STATE_SET "clicked" 0.0;
         target: "close";
      }
      program { signal: "mouse,up,1"; source: "del";
         action: STATE_SET "default" 0.0;
         target: "close";
      }
   }
}

group { name: "elm/multibuttonentry/closedbutton/default";
   styles {
      style { name: "textblock_style_multibuttonentry_default";
         base: "font="FNBD" font_size=10 text_class=multibuttonentry_closed color=#fff align=center wrap=char"; /// no cc for color
         tag: "br" "\n";
         tag: "ps" "ps";
         tag: "hilight" "+ font="FNBD;
         tag: "b" "+ font="FNBD;
         tag: "tab" "\t";
      }
   }
   parts {
      part { name: "bg"; type: RECT;
         description { state: "default" 0.0;
            color: 0 0 0 0; // no cc
         }
      }
      part { name: "elm.text"; type: TEXTBLOCK; mouse_events: 0;
         scale: 1;
         description { state: "default" 0.0;
            rel.to: "bg";
            rel1.offset: 4 4;
            rel2.offset: -5 -5;
            text { style: "textblock_style_multibuttonentry_default";
               min: 1 1;
               ellipsis: -1;
            }
            offscale;
            color_class: "/fg/normal/multibuttonentry/button/text";
         }
      }
   }
}
